home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Disc to the Future 2
/
Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin
/
MAC
/
OTHER_LA
/
QUINTA
/
FIT.Q
< prev
next >
Wrap
Text File
|
1990-03-22
|
684b
|
28 lines
;
; This is an example of a curve fit using Quinta. The message polyfit
; accepts an integer and a matrix of points. The matrix must be of
; dimensions n by 2, where each row of the matrix is a data point, the
; x coordinates in column 1. The integer argument is the order of the
; desired polynomial. The example below requests the polynomial of
; order 2 which best fits the 4 data points (-2,6) (-1,0) (1,8) (2,17).
;
2
-2 6 -1 0 1 8 2 17 4 2 >dim >mat
polyfit
print
; The resulting matrix is indicated below. This means that the best
; fit 2nd order polynomial (in x) for the above data points is:
; 1.5 + 3x + (2.5)x^2
; | 1.5 |
; | 3 |
; | 2.5 |